<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
	<c:choose>
		<c:when test="${page.currentPage<=4 && page.totalPage >5}">
			<c:set var="startPage"  value="1"></c:set>
			<c:set var="endPage"  value="5"></c:set>
			<c:set var="firstStyle"  value="display: none;"></c:set>
			<c:set var="lastStyle"  value=""></c:set>
		</c:when>
		<c:when test="${page.currentPage<=5 && page.totalPage <=5}">
			<c:set var="startPage"  value="1"></c:set>
			<c:set var="endPage"  value="${page.totalPage}"></c:set>
			<c:set var="firstStyle"  value="display: none;"></c:set>
			<c:set var="lastStyle"  value="display: none;"></c:set>
		</c:when>
		
		<c:when test="${page.currentPage>4 && page.currentPage <= page.totalPage- 4}">
			<c:set var="startPage"  value="${page.currentPage-2}"></c:set>
			<c:set var="endPage"  value="${page.currentPage+2}"></c:set>
			<c:set var="firstStyle"  value=""></c:set>
			<c:set var="lastStyle"  value=""></c:set>
		</c:when>
		
		<c:when test="${page.currentPage>4 && page.currentPage > page.totalPage- 4}">
			<c:set var="startPage"  value="${page.totalPage-4}"></c:set>
			<c:set var="endPage"  value="${page.totalPage}"></c:set>
			<c:set var="firstStyle"  value=""></c:set>
			<c:set var="lastStyle"  value="display: none;"></c:set>
		</c:when>
	</c:choose>
	<c:choose>
		<c:when test="${page.currentPage == 1}">
			<c:set var="prevStyle" value="display: none;"></c:set>
		</c:when>
		<c:otherwise>
			<c:set var="prevStyle" value=""></c:set>
		</c:otherwise>
	</c:choose>

	<c:choose>
		<c:when test="${page.totalPage == 0 || page.currentPage == page.totalPage}">
			<c:set var="nextStyle" value="display: none;"></c:set>
		</c:when>
		<c:otherwise>
			<c:set var="nextStyle" value=""></c:set>
		</c:otherwise>
	</c:choose>
	<div style="clear: both"></div>
	<div class="msdn">
		<a href="${param.actionName}page.currentPage=${page.currentPage-1}" style="${prevStyle}" >上一页</a>
		<a href="${param.actionName}page.currentPage=1" style="${firstStyle}" >1</a><span style="${firstStyle}">...</span>
		<c:if test="${endPage != 1 }">
			<c:forEach var="i" begin="${startPage }" end="${endPage }" step="1">
			<c:choose>
				<c:when test="${i == page.currentPage}">
					<span class="current">${i}</span>
				</c:when>
				<c:otherwise>
					<a href="${param.actionName}page.currentPage=${i}">${i}</a>
				</c:otherwise>
			</c:choose>
		</c:forEach>
		</c:if>
		<span style="${lastStyle}">...</span>
		<a href="${param.actionName}page.currentPage=${page.totalPage}" style="${lastStyle}" >${page.totalPage}</a>
		<a href="${param.actionName}page.currentPage=${page.currentPage+1}" style="${nextStyle}" >下一页</a>
	</div>